package com.study.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Required;

import javax.annotation.Resource;

public class HelloWorld {

    public HelloWorld() { }
    public HelloWorld(String message) {
        this.message = message;
    }

    private String message;

    //@Qualifier("englishSayWay")
    //@Autowired
    @Resource(name = "englishSayWay")
    private SayWay sayWay;


    public void say(){
        sayWay.say(message);
    }

    @Required
    public void setMessage(String message) {
        this.message = message;
    }

    public void desctory(){
        System.out.println("我要銷毀了");
    }

    public void init() {
        System.out.println("我在初始化中");
        //
    }
}
